﻿<UserControl 
    x:Class="MediaBrowserSL.RIA.Views.PageMoviesView"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:jadeControls="http://www.sebastien-alves.fr/jadeToolsSLControls"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:bindingHelpers="clr-namespace:JulMar.Siverlight.Helpers.BindingHelpers;assembly=JulMar.Siverlight.Helpers"
    mc:Ignorable="d"
    xmlns:Converters="clr-namespace:MediaBrowserSL.RIA.Converters"
    d:DesignHeight="600" d:DesignWidth="800" 
    >

    <UserControl.DataContext>
        <Binding Mode="OneWay" Path="Movies" Source="{StaticResource Locator}"/>
    </UserControl.DataContext>

    <UserControl.Resources>
        <Converters:StringToImageLoaderConverter x:Key="stringToImageLoaderConverter" />
        <Converters:DateConverter x:Key="DateConverter" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="500"/>
        </Grid.ColumnDefinitions>

        <!--LEFT-->
        <Grid Grid.Column="0" Margin="10,10,10,10">


            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" BorderThickness="1,1,1,0" CornerRadius="0,0,1,1" Background="{StaticResource BackGrdCustom}" BorderBrush="{StaticResource NormalBorderBrush}">
                <sdk:Label Content="Liste des Films" Foreground="White" Margin="5,0,0,0" />
            </Border>

            <Border Grid.Row="1" BorderThickness="2,0,2,2" CornerRadius="0,0,4,4" Padding="4" BorderBrush="{StaticResource NormalBorderBrush}">

                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#19000000" Offset="0"/>
                        <GradientStop Color="#6656747A" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>

                <Grid>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>

                    <StackPanel x:Name="bd"
                    Grid.Row="0"
                    Orientation="Horizontal"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Center">
                        <TextBox x:Name="tbSearch" Width="150" Text="{Binding MediaLookFor, Mode=TwoWay}" bindingHelpers:BindingTextHelper.UpdateSourceOnChange="True" />
                    </StackPanel>

                    <ListBox x:Name="lMedias" ItemsSource="{Binding Path=MediasView}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" DisplayMemberPath="Name" Grid.Row="1" Background="{x:Null}"/>

                    <Grid Grid.Row="2">
                        <jadeControls:ImageButton x:Name="btPlay" Source="/MediaBrowserSL.RIA;component/Images/film_go.png" 
                                                       Height="20" Margin="2,0,0,0"
                                                       HorizontalAlignment="Left" Width="20" Command="{Binding PlayVideoCmmand}" ToolTipService.ToolTip="Jouer la video" >
                        </jadeControls:ImageButton>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" >
                            <jadeControls:ImageButton x:Name="btAdd" Command="{Binding PrepareAddMovieCommand}" ToolTipService.ToolTip="Ajouter un film" Source="/MediaBrowserSL.RIA;component/Images/film_add.png" Height="20" Margin="0,0,5,0" />
                            <jadeControls:ImageButton x:Name="btUp" Command="{Binding PrepareUpdateMovieCommand}" ToolTipService.ToolTip="Modifier le film" Source="/MediaBrowserSL.RIA;component/Images/film_edit.png" Height="20" Margin="0,0,5,0" />
                            <Grid Margin="0,0,1,0">
                                <jadeControls:ImageButton Command="{Binding DeleteMovieCommand}" ToolTipService.ToolTip="Supprimer le film" Source="/MediaBrowserSL.RIA;component/Images/film_delete.png" Height="20" />
                                <jadeControls:Loading IsLoading="{Binding IsDeleting}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                            </Grid>

                        </StackPanel>
                    </Grid>

                </Grid>


            </Border>
        </Grid>
        <!--LEFT-->

        <!-- GRID DATA -->
        <Grid Grid.Column="1" Margin="10,10,10,10">


            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" BorderThickness="1,1,1,0" CornerRadius="0,0,1,1" Background="{StaticResource BackGrdCustom}" BorderBrush="{StaticResource NormalBorderBrush}">
                <sdk:Label Content="Description" Foreground="White" Margin="5,0,0,0" />
            </Border>

            <Border Grid.Row="1" BorderThickness="2,0,2,2" CornerRadius="0,0,4,4" Padding="4" BorderBrush="{StaticResource NormalBorderBrush}">

                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#19000000" Offset="0"/>
                        <GradientStop Color="#6656747A" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>

                <Grid x:Name="Grid_Data" Margin="0,5,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20" />
                        <RowDefinition Height="20" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="250"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <sdk:Label Grid.Column="0" Grid.Row="0" Content="Nom : " Foreground="Gray"/>
                    <sdk:Label Grid.Column="1" Grid.Row="0" Content="{Binding CurrentMedia.Name}" Foreground="WhiteSmoke" />

                    <sdk:Label Grid.Column="0" Grid.Row="1" Content="Date création : " Foreground="Gray" />
                    <sdk:Label Grid.Column="1" Grid.Row="1" Content="{Binding CurrentMedia.CreationDate, Converter={StaticResource DateConverter}}" Foreground="WhiteSmoke"  />

                    <sdk:Label Grid.Column="0" Grid.Row="2" Content="Description" Foreground="Gray" />

                    <TextBox x:Name="textBox" Grid.Row="3" Grid.ColumnSpan="3" IsReadOnly="True"
                         Text="{Binding CurrentMedia.Description}"
                         TextWrapping="Wrap" 
                         AcceptsReturn="True" FontSize="13.333">
                        <TextBox.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFD1D4D6" Offset="0"/>
                                <GradientStop Color="White" Offset="0.511"/>
                                <GradientStop Color="White" Offset="1"/>
                            </LinearGradientBrush>
                        </TextBox.Background>
                    </TextBox>
                </Grid>


            </Border>
        </Grid>
        <!-- GRID DATA -->

        <!-- GRID IMG -->
        <Grid Grid.Column="2" Margin="10,10,10,10">


            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" BorderThickness="1,1,1,0" CornerRadius="0,0,1,1" Background="{StaticResource BackGrdCustom}" BorderBrush="{StaticResource NormalBorderBrush}">
                <sdk:Label Content="Affiche" Foreground="White" Margin="5,0,0,0" />
            </Border>

            <Border Grid.Row="1" BorderThickness="2,0,2,2" CornerRadius="0,0,4,4" Padding="4" BorderBrush="{StaticResource NormalBorderBrush}">

                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#19000000" Offset="0"/>
                        <GradientStop Color="#6656747A" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>

                <jadeControls:FadeTransition ContentTransition="{Binding CurrentMedia.UrlImage,Converter={StaticResource stringToImageLoaderConverter}}" BorderThickness="0,5,0,0" Margin="0,5,0,0"/>

            </Border>
        </Grid>
        <!-- GRID IMG -->


    </Grid>


</UserControl>
